home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / netBoot.OpenProm / mon / openprom.h < prev   
Encoding:
C/C++ Source or Header  |  1991-01-09  |  5.2 KB  |  177 lines

  1. /*
  2.  * @(#)openprom.h 1.10 90/08/22 SMI
  3.  * Copyright (c) 1989-1990 Sun Microsystems, Inc.
  4.  *
  5.  *
  6.  * This file defines the interface between the Open Boot Prom Monitor
  7.  * and the programs that may request its services.
  8.  * This interface, defined as a vector of pointers to useful things,
  9.  * has been traditionally referred to as `the romvec'.
  10.  *
  11.  * The address of the romvec is passed as the first argument to the standalone
  12.  * program, obviating the need for the address to be at a known fixed
  13.  * location.
  14.  * Typically, the stand-alone's srt0.s file (which contains the _start entry)
  15.  * would take care of all of `this'.
  16.  * In SPARC assembler, `this' would be:
  17.  *
  18.  *    .data
  19.  *    .global _romp
  20.  * _romp:
  21.  *    .word 0
  22.  *    .text
  23.  * _start:
  24.  *    set    _romp, %o1    ! any register other than %o0 will probably do
  25.  *    st    %o0, [%o1]    ! save it away
  26.  *    .......            ! set up your stack, etc......
  27.  */
  28.  
  29. #ifndef _mon_openprom_h
  30. #define    _mon_openprom_h
  31.  
  32. #ifndef _TYPES_
  33. #include <sys/types.h>
  34. #endif _TYPES_
  35.  
  36. #ifndef OPENPROMS
  37. #  define OPENPROMS            /* for inquisitive minds */
  38. #endif  !OPENPROMS
  39. #define    ROMVEC_MAGIC    0x10010407    /* hmmm */
  40. #define    ROMVEC_VERSION     1
  41. #define    PLUGIN_VERSION    2
  42. #define    ROMVEC_BLKSIZE    512
  43.  
  44. typedef u_int ihandle_t;
  45. typedef u_int phandle_t;
  46.  
  47. extern struct sunromvec *romp;        /* as per the above discussion */
  48.  
  49. /*
  50.  * Memory layout stuff
  51.  */
  52. struct memlist {
  53.     struct memlist    *next;        /* link to next list element */
  54.     u_int        address;    /* starting address of memory segment */
  55.     u_int        size;        /* size of same */
  56. };
  57.  
  58.  
  59. struct sunromvec {
  60.     u_int    v_magic;        /* magic mushroom */
  61.     u_int    v_romvec_version;    /* Version number of "romvec" */
  62.     u_int    v_plugin_version;    /* Plugin Architecture version */
  63.     u_int    v_mon_id;        /* version # of monitor firmware */
  64.     struct memlist    **v_physmemory;    /* V0: total physical memory list */
  65.     struct memlist    **v_virtmemory;    /* V0: taken virtual memory list */
  66.     struct memlist    **v_availmemory; /* V0: available physical memory */
  67.     struct config_ops *v_config_ops; /* dev_info configuration access */
  68.     /*
  69.      * storage device access facilities
  70.      */
  71.     char    **v_bootcommand;    /* expanded with PROM defaults */
  72.     u_int    (*v_open)(/* char *name */);
  73.     u_int    (*v_close)(/* ihandle_t fileid */);
  74.     /*
  75.      * block-oriented device access
  76.      */
  77.     u_int    (*v_read_blocks)();    /* V0 */
  78.     u_int    (*v_write_blocks)();    /* V0 */
  79.     /*
  80.      * network device access
  81.      */
  82.     u_int    (*v_xmit_packet)();    /* V0 */
  83.     u_int    (*v_poll_packet)();    /* V0 */
  84.     /*
  85.      * byte-oriented device access
  86.      */
  87.     u_int    (*v_read_bytes)();    /* V0 */
  88.     u_int    (*v_write_bytes)();    /* V0 */
  89.  
  90.     /*
  91.      * 'File' access - i.e., Tapes for byte devices, TFTP
  92.      * for network devices
  93.      */
  94.     u_int    (*v_seek)();
  95.     /*
  96.      * single character I/O
  97.      */
  98.     u_char    *v_insource;        /* Current source of input */
  99.     u_char    *v_outsink;        /* Currrent output sink */
  100.     u_char    (*v_getchar)();        /* Get a character from input */
  101.     void    (*v_putchar)();        /* Put a character to output sink. */
  102.     int    (*v_mayget)();        /* Maybe get a character, or "-1". */
  103.     int    (*v_mayput)();        /* Maybe put a character, or "-1". */
  104.     /*
  105.      * Frame buffer
  106.      */
  107.     void    (*v_fwritestr)();    /* write a string to framebuffer */
  108.     /*
  109.      * Miscellaneous Goodies
  110.      */
  111.     void    (*v_boot_me)();        /* reboot machine */
  112.     int    (*v_printf)();        /* handles format string plus 5 args */
  113.     void    (*v_abortent)();    /* Entry for keyboard abort. */
  114.     int    *v_nmiclock;        /* Counts in milliseconds. */
  115.     void    (*v_exit_to_mon)();    /* Exit from user program. */
  116.     void    (**v_vector_cmd)();    /* Handler for the vector */
  117.     void    (*v_interpret)();    /* interpret forth string */
  118.  
  119. #ifdef SAIO_COMPAT
  120.     struct bootparam **v_bootparam;    /*
  121.                      * V0: boot parameters and `old' style
  122.                      * device access
  123.                      */
  124. #else
  125.     int    v_fill0;
  126. #endif SAIO_COMPAT
  127.  
  128.     u_int    (*v_mac_address)(/* int fd; caddr_t buf */);
  129.                     /* Copyout ether address */
  130.     char    **bootpath;        /* V2: Full path name of boot device */
  131.     char    **bootargs;        /* V2: Boot cmd line after dev spec */
  132.  
  133.     ihandle_t *op_stdin;        /* V2: Console input device */
  134.     ihandle_t *op_stdout;        /* V2: Console output device */
  135.  
  136.     phandle_t (*op_phandle)(/* ihandle_t ihandle */);
  137.                     /* V2: Convert ihandle to phandle */
  138.  
  139.     caddr_t    (*op_alloc)(/* caddr_t virthint, u_int size */);
  140.                     /* V2: Allocate physical memory */
  141.  
  142.     void    (*op_free)(/* caddr_t virt, u_int size */);
  143.                     /* V2: Deallocate physical memory */
  144.  
  145.     caddr_t    (*op_map)(/* caddr_t virthint, u_int space, u_int phys,
  146.             u_int size */);    /* V2: Create device mapping */
  147.  
  148.     void    (*op_unmap)(/* caddr_t virt, u_int size */);
  149.                     /* V2: Destroy device mapping */
  150.  
  151.     ihandle_t (*op_open)(/* char *name */);
  152.     u_int    (*op_close)(/* ihandle_t fileid */);
  153.     int    (*op_read)(/* ihandle_t fileid, caddr_t buf, u_int len */);
  154.     int    (*op_write)(/* ihandle_t fileid, caddr_t buf, u_int len */);
  155.     int    (*op_seek)(/* ihandle_t fileid, u_int offsh, u_int offsl */);
  156.     void    (*op_chain)(/* caddr_t virt, u_int size, caddr_t entry,
  157.             caddr_t argaddr, u_int arglen */);
  158.     void    (*op_release)(/* caddr_t virt, u_int size */);
  159.  
  160.     int    *v_reserved[15];
  161.     /*
  162.      * Beginning of machine-dependent portion
  163.      */
  164. #include <machine/romvec.h>
  165. };
  166.  
  167. /*
  168.  * XXX - This is not, strictly speaking, correct: we should never
  169.  * depend upon "magic addresses". However, the MONSTART/MONEND
  170.  * addresses are wired into too many standalones, and they are
  171.  * not likely to change in any event.
  172.  */
  173. #define    MONSTART    (0xffd00000)
  174. #define    MONEND        (0xfff00000)
  175.  
  176. #endif _mon_openprom_h
  177.